package com.hxm.demo.test1;

import java.util.Scanner;

/**
 * @author huangxiaoming
 * @description
 * @date 2022/6/11 17:23
 */
public class TestFloor {
    /**
     * 爬楼梯
     *
     * @param args
     */
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextLine()) { // 注意 while 处理多个 case
            int i = in.nextInt();
            System.out.println(floor(i));
        }
    }

    private static int floor(int n) {
        if (n == 1 || n == 2) {
            return n;
        }
        int step1 = 1;
        int step2 = 2;
        for (int i = 3; i <= n; i++) {
            int cur = step1 + step2;
            step1 = step2;
            step2 = cur;
        }
        return step2;
    }
}
